package com.example.administrator.hello;

import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import android.support.test.uiautomator.By;
import android.support.test.uiautomator.UiDevice;
import android.support.test.uiautomator.UiObject2;

import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;


/**
 * Created by Administrator on 2017/7/15.
 */
@RunWith(AndroidJUnit4.class)
public class LoginTest {
    private  UiDevice device;

    @Before
    public  void setUp() throws Exception {
         device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());

    }

    @Test
    public void name() throws Exception {
        Thread.sleep(3000) ;
        device.findObject(By.res("net.oschina.app:id/et_login_username")).clear();
        device.findObject(By.res("net.oschina.app:id/et_login_pwd")).clear();

        UiObject2 firstNumber = device.findObject(By.res("net.oschina.app:id/et_login_username"));
        firstNumber.setText("123456");
        UiObject2 secondNumber=device.findObject(By.res("net.oschina.app:id/et_login_pwd"));
        secondNumber.setText("123456");
    }

}
